// Copyright 2016 The Android Open Source Project
//
// This software is licensed under the terms of the GNU General Public
// License version 2, as published by the Free Software Foundation, and
// may be copied, distributed, and modified under those terms.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

#pragma once

#include "android/avd/info.h"
#include "android/avd/util.h"
#include "android/cmdline-option.h"
#include "android/utils/compiler.h"

ANDROID_BEGIN_HEADER

typedef struct QemuParameters QemuParameters;

// Generate the list of parameters to pass to the underlying QEMU engine.
// |argv0| is the initial program name/path.
// |argc| and |argv| are the QEMU-specific command-line options, if any.
// |opts| is the current set of options, |avd| the AVD information instance,
// |kernelParameters| a optional string describing the kernel parameters,
// and |androidHwInitPath| the path to the final generated harware.ini file
// generated by this function.
// |isQemu2| should be true iff the engine is QEMU2 (otherwise QEMU1 is
// assumed). Finally |targetArch| is the target CPU architecture.
// Return NULL on failure.
QemuParameters* qemu_parameters_create(const char* argv0,
                                       int qemuArgc,
                                       const char* const* qemuArgv,
                                       AndroidOptions* opts,
                                       const AvdInfo* avd,
                                       const char* kernelParameters,
                                       const char* androidHwInitPath,
                                       bool isQemu2,
                                       const char* targetArch);

size_t qemu_parameters_size(const QemuParameters* params);
char** qemu_parameters_array(const QemuParameters* params);

void qemu_parameters_free(QemuParameters* params);

ANDROID_END_HEADER
